import Datastore from 'nedb'

let db = {}
db.users = new Datastore({filename: './kumeng_users.db', autoload: true})
db.records = new Datastore({filename: './kumeng_records.db', autoload: true})
db.category = new Datastore({filename: './kumeng_category.db', autoload: true})
db.petBreed = new Datastore({filename: './kumeng_pet_breed.db', autoload: true})
db.users.ensureIndex({fieldName: 'id', unique: true})
db.users.ensureIndex({fieldName: 'phone', unique: true})
db.records.ensureIndex({fieldName: 'id', unique: true})
db.category.ensureIndex({fieldName: 'id', unique: true})
db.petBreed.ensureIndex({fieldName: 'id', unique: true})
export default db // 暴露出去
